#include "main.h"

#include <ncine/Application.h>
#include <ncine/AppConfiguration.h>
#include <ncine/IFile.h> // for dataPath()

ng::Engine* createEngine() {
	return new MyGame;
}

void MyGame::onPreInit(nc::AppConfiguration &config)
{
#if defined(__ANDROID__)
	config.dataPath() = "asset::";
#elif defined(__EMSCRIPTEN__)
	config.dataPath() = "/";
#else
	#ifdef PACKAGE_DEFAULT_DATA_DIR
	config.dataPath() = PACKAGE_DEFAULT_DATA_DIR;
	#else
	config.dataPath() = "data/";
	#endif
#endif

	config.windowTitle = "template";
	config.windowIconFilename = "icon48.png";
}

void MyGame::onInit() {
	loadXmlFile(nc::IFile::dataPath() + "template.dat");
}

void MyGame::onKeyReleased(const nc::KeyboardEvent &event)
{
	if (event.sym == nc::KeySym::ESCAPE)
		nc::theApplication().quit();
}
